capture log close
log using "isq_supplements.log", replace text


//  program:    isq_supplements.do
//  task:      	supplemental results
//  project:    poladopt



//  #0

version 14
set linesize 80
clear all
macro drop _all
set more off
set matsize 11000 



//  #1
//  load data

use "isq_poladopt.dta", clear



//  #2
//  descriptive table
local base ln_rgdpch_pwt71 grgdpchtl_pwt71 crisis_lv_B totfinasset_gfddV6 ///
	L_dpi12 OC imf_prgf5 imf_eff5 imf_sba5 

qui xtlogit defacto3N `base' c.polity2_polV2##c.society i.year , re
su defacto3N `base' R_dpi polity2_polV2 libdem_vdem71 society



//  #3
//  robustness check

local base ln_rgdpch_pwt71 grgdpchtl_pwt71 crisis_lv_B totfinasset_gfddV6 ///
	L_dpi12 OC_dpi12 imf_prgf5 imf_eff5 imf_sba5 

local vars openk_pwt71 pta_ratifB ///
	frac_dpi12 govfrac_dpi12 ///
	yrsoffc_dpi12 firstyroffice ///
	cohesion_brk cohesion_dejure contig_brk ///
	 ln_govtgrossdebtgdp ///
	lvau_garriga ///
	"presidential_dpi12 parliamentary_dpi12"

foreach v in `vars' {

	* FE with goldstein with polity 
	eststo : logit defacto3N c.polity2_polV2##c.society `v' `base' i.year i.cid 
		testparm c.polity2_polV2##c.society
		estadd scalar jtsig =`r(p)'	

	* RE with goldstein with polity	
	eststo : xtlogit defacto3N c.polity2_polV2##c.society `v' `base'  i.year , re
		testparm c.polity2_polV2##c.society
		estadd scalar jtsig =`r(p)'	
			
	* FE with goldstein with vdem libdem
	eststo : logit defacto3N c.libdem_vdem71##c.society `v' `base' i.year i.cid 
		testparm c.libdem_vdem71##c.society
		estadd scalar jtsig =`r(p)'	
		
	* RE with goldstein with vdem libdem	
	eststo : xtlogit defacto3N c.libdem_vdem71##c.society `v' `base'  i.year , re
		testparm c.libdem_vdem71##c.society
		estadd scalar jtsig =`r(p)'	

	}
	
* FE with goldstein with polity, tbill (wo year FE)
	eststo : logit defacto3N c.polity2_polV2##c.society tbill_ifs `base' i.cid
		testparm c.polity2_polV2##c.society
		estadd scalar jtsig =`r(p)'	
		
* RE with goldstein with polity, tbill (wo year FE)
	eststo : xtlogit defacto3N c.polity2_polV2##c.society tbill_ifs `base' , re
		testparm c.polity2_polV2##c.society
		estadd scalar jtsig =`r(p)'	
			
* FE with goldstein with vdem libdem, tbill (wo year FE)
	eststo : logit defacto3N c.libdem_vdem71##c.society tbill_ifs `base' i.cid
		testparm c.libdem_vdem71##c.society
		estadd scalar jtsig =`r(p)'	

* RE with goldstein with vdem libdem, tbill (wo year FE)
	eststo : xtlogit defacto3N c.libdem_vdem71##c.society tbill_ifs `base' , re
		testparm c.libdem_vdem71##c.society
		estadd scalar jtsig =`r(p)'	
			
* FE with goldstein with polity, 3mo security (wo year FE)
	eststo : logit defacto3N c.polity2_polV2##c.society govint3mos_ifs `base' i.cid
		testparm c.polity2_polV2##c.society
		estadd scalar jtsig =`r(p)'	
		
* RE with goldstein with polity, 3mo security (wo year FE)
	eststo : xtlogit defacto3N c.polity2_polV2##c.society govint3mos_ifs `base' , re
		testparm c.polity2_polV2##c.society
		estadd scalar jtsig =`r(p)'	
			
* FE with goldstein with vdem libdem, 3mo security (wo year FE)
	eststo : logit defacto3N c.libdem_vdem71##c.society govint3mos_ifs `base' i.cid
		testparm c.libdem_vdem71##c.society
		estadd scalar jtsig =`r(p)'	

* RE with goldstein with vdem libdem, 3mo security (wo year FE)
	eststo : xtlogit defacto3N c.libdem_vdem71##c.society govint3mos_ifs `base' , re
		testparm c.libdem_vdem71##c.society
		estadd scalar jtsig =`r(p)'	
		
esttab using isq_robust.csv , replace nobase /// 
	b(3) se(3) drop(*cid* *year*) ///
	scalars("N N" "ll LogLikelihood" "chi2_c C2" "jtsig JointSig") ///
	sfmt(%12.0f %12.3f) obslast  ///
	star(* .1 ** .05 *** .01)
est clear



//  #4
//  different year window between de jure and de facto

local base ln_rgdpch_pwt71 grgdpchtl_pwt71 crisis_lv_B totfinasset_gfddV6 ///
	L_dpi12 OC_dpi12 imf_prgf5 imf_eff5 imf_sba5 

** 3 years
* FE with goldstein with polity 
eststo : logit defacto3N c.polity2_polV2##c.society `base' i.year i.cid 
	testparm c.polity2_polV2##c.society
	estadd scalar jtsig =`r(p)'	

* RE with goldstein with polity	
eststo : xtlogit defacto3N c.polity2_polV2##c.society `base'  i.year , re
	testparm c.polity2_polV2##c.society
	estadd scalar jtsig =`r(p)'	
		
* FE with goldstein with vdem libdem
eststo : logit defacto3N c.libdem_vdem71##c.society `base' i.year i.cid 
	testparm c.libdem_vdem71##c.society
	estadd scalar jtsig =`r(p)'	
	
* RE with goldstein with vdem libdem	
eststo : xtlogit defacto3N c.libdem_vdem71##c.society `base'  i.year , re
	testparm c.libdem_vdem71##c.society
	estadd scalar jtsig =`r(p)'	

	
** 4 years
* FE with goldstein with polity 
eststo : logit defacto4N c.polity2_polV2##c.society `base' i.year i.cid 
	testparm c.polity2_polV2##c.society
	estadd scalar jtsig =`r(p)'	

* RE with goldstein with polity	
eststo : xtlogit defacto4N c.polity2_polV2##c.society `base'  i.year , re
	testparm c.polity2_polV2##c.society
	estadd scalar jtsig =`r(p)'	
		
* FE with goldstein with vdem libdem
eststo : logit defacto4N c.libdem_vdem71##c.society `base' i.year i.cid 
	testparm c.libdem_vdem71##c.society
	estadd scalar jtsig =`r(p)'	
	
* RE with goldstein with vdem libdem	
eststo : xtlogit defacto4N c.libdem_vdem71##c.society `base'  i.year , re
	testparm c.libdem_vdem71##c.society
	estadd scalar jtsig =`r(p)'	

esttab using isq_diffyrwindow.csv , replace nobase /// 
	b(3) se(3) drop(*cid* *year*) ///
	scalars("N N" "ll LogLikelihood" "chi2_c C2" "jtsig JointSig") ///
	sfmt(%12.0f %12.3f) obslast  ///
	star(* .1 ** .05 *** .01)
est clear




//  #5
//  polcon * society interactio
local base ln_rgdpch_pwt71 grgdpchtl_pwt71 crisis_lv_B totfinasset_gfddV6 ///
	L_dpi12 OC_dpi12 imf_prgf5 imf_eff5 imf_sba5 

* FE with goldstein with polcon 
eststo : logit defacto3N c.polconiii_polcon13##c.society `base' i.year i.cid 
	testparm c.polconiii_polcon13##c.society
	estadd scalar jtsig =`r(p)'	

* RE with goldstein with polcon	
eststo : xtlogit defacto3N c.polconiii_polcon13##c.society `base' i.year , re
	testparm c.polconiii_polcon13##c.society
	estadd scalar jtsig =`r(p)'	
		
esttab using isq_polcon.csv , replace nobase /// 
	b(3) se(3) drop(*cid* *year*) ///
	scalars("N N" "ll LogLikelihood" "chi2_c C2" "jtsig JointSig") ///
	sfmt(%12.0f %12.3f) obslast  ///
	star(* .1 ** .05 *** .01)
est clear




//  #6
//  polity components
foreach i in xconst2 xropen2 parcomp2 xrcomp2 parreg2 xrreg2 {

	local base ln_rgdpch_pwt71 grgdpchtl_pwt71 crisis_lv_B totfinasset_gfddV6 ///
		L_dpi12 OC_dpi12 imf_prgf5 imf_eff5 imf_sba5 
	
	eststo : logit defacto3N `base' c.`i'##c.society i.year i.cid  
		testparm c.`i'##c.society
		estadd scalar jtsig =`r(p)'
		testparm c.xconst2##c.society
		
	eststo : xtlogit defacto3N `base' c.`i'##c.society i.year , re
		testparm c.`i'##c.society
		estadd scalar jtsig =`r(p)'
		testparm c.xconst2##c.society
		
	}
	
foreach i in xropen2 parcomp2 xrcomp2 parreg2 xrreg2 {

	local base ln_rgdpch_pwt71 grgdpchtl_pwt71 crisis_lv_B totfinasset_gfddV6 ///
		L_dpi12 OC_dpi12 imf_prgf5 imf_eff5 imf_sba5 
	
	eststo : logit defacto3N `base' c.(xconst2 `i')##c.society i.year i.cid  
		testparm c.(xconst2 `i')##c.society
		estadd scalar jtsig =`r(p)'
		testparm c.xconst2##c.society
		
	eststo : xtlogit defacto3N `base' c.(xconst2 `i')##c.society i.year , re
		testparm c.(xconst2 `i')##c.society
		estadd scalar jtsig =`r(p)'
		testparm c.xconst2##c.society
		
	}
	
esttab using isq_politycomponents.csv , replace nobase /// 
	b(3) se(3) drop(*cid* *year*) ///
	scalars("N N" "ll LogLikelihood" "chi2_c C2" "jtsig JointSig") ///
	sfmt(%12.0f %12.3f) obslast  ///
	star(* .1 ** .05 *** .01)
est clear




//  #7
//  interflex (only 95% ci available, no t-test available)

local base ln_rgdpch_pwt71 grgdpchtl_pwt71 crisis_lv_B totfinasset_gfddV6 ///
	L_dpi12 OC_dpi12 imf_prgf5 imf_eff5 imf_sba5 
	
logit defacto3N `base' c.polity2_polV2##c.society i.year i.cid 
	lmoments society if e(sample)

* drop high-low
hilo society if e(sample)
local base ln_rgdpch_pwt71 grgdpchtl_pwt71 crisis_lv_B totfinasset_gfddV6 ///
	L_dpi12 OC_dpi12 imf_prgf5 imf_eff5 imf_sba5 
	
logit defacto3N `base' c.polity2_polV2##c.society i.year i.cid ///
	if inrange(society , 8.5 , 14)
	lmoments society if e(sample)
	testparm c.polity2_polV2##c.society
* lkurt .151

local base ln_rgdpch_pwt71 grgdpchtl_pwt71 crisis_lv_B totfinasset_gfddV6 ///
	L_dpi12 OC_dpi12 imf_prgf5 imf_eff5 imf_sba5 
	
interflex defacto3N polity2_polV2 society `base'   ///
	, fe(cid year) type(linear)		
graph save "linear.gph" , replace	
		
interflex defacto3N polity2_polV2 society `base'   ///
	, fe(cid year) nbin(7)	
graph save "bin7.gph" , replace	
 
interflex defacto3N polity2_polV2 society `base'   ///
	, fe(cid year) type(kernel) cluster(cid)		
graph save "kernel.gph" , replace	


log close
clear
exit
